<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:p="http://primefaces.org/ui"
	template="/templates/templateListar.xhtml">

	<ui:define name="conteudo">
		<ui:param name="actionBean" value="#{relatorioAnimalMB}" />
		<p:panel header="Relatório de Animais">
			<h:form id="frmDialogRelatorio">
				<div align="center">
					<h:panelGrid columns="3" style="text-align:left">
						<p:selectBooleanCheckbox
							value="#{relatorioAnimalMB.filtroCliente}">
							<p:ajax event="change" update="outpanelcliente" listener="#{relatorioAnimalMB.atualizaCliente}"></p:ajax>
						</p:selectBooleanCheckbox>

						<p:outputLabel value="Cliente:"></p:outputLabel>
						<p:outputPanel id="outpanelcliente">
							<p:selectOneMenu id="cliente" filterMatchMode="contains"
								disabled="#{not relatorioAnimalMB.filtroCliente}" filter="true"
								required="#{relatorioAnimalMB.filtroCliente}" converter="clienteConverter"
								value="#{relatorioAnimalMB.cliente}" style="width:222px;">
								<f:selectItem itemLabel="" itemValue="#{null}" />
								<f:selectItems value="#{relatorioAnimalMB.listaCliente}"
									var="cliente" itemLabel="#{cliente.dadosCadastro.nome}"
									itemValue="#{cliente}"></f:selectItems>
							</p:selectOneMenu>
						</p:outputPanel>
					</h:panelGrid>

					<h:panelGrid columns="2" style="text-align:center">
						<p:selectBooleanCheckbox value="#{relatorioAnimalMB.filtroData}">
							<p:ajax event="change" update="outpanelperiodo" listener="#{relatorioAnimalMB.atualizaData}"></p:ajax>
						</p:selectBooleanCheckbox>
						<p:outputPanel id="outpanelperiodo">
							<h:panelGrid columns="4" style="text-align:center">
								<p:outputLabel value="Período:" for="datainicial" />
								<p:inputMask value="#{relatorioAnimalMB.periodo.dataInicial}"
									required="#{relatorioAnimalMB.filtroData}" maxlength="10"
									size="10" disabled="#{not relatorioAnimalMB.filtroData}"
									requiredMessage="Data Inicial é obrigatória!" id="datainicial"
									mask="99/99/9999">
									<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
								</p:inputMask>

								<p:outputLabel value=" a "></p:outputLabel>

								<p:inputMask id="datafinal"
									required="#{relatorioAnimalMB.filtroData}"
									requiredMessage="Data Final é obrigatória"
									disabled="#{not relatorioAnimalMB.filtroData}"
									value="#{relatorioAnimalMB.periodo.dataFinal}"
									mask="99/99/9999" size="10" maxlength="10">
									<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
								</p:inputMask>
							</h:panelGrid>
						</p:outputPanel>

					</h:panelGrid>

				</div>
				<div align="center">
					<h:panelGrid columns="3">
						<p:spacer width="60" height="2"></p:spacer>
						<p:commandButton value="Confirma" ajax="false"
							style="text-align:center"
							actionListener="#{relatorioAnimalMB.gerarRelatorio}"
							update=":mensagem">
						</p:commandButton>
						<p:commandButton value="Cancela" immediate="true"
							action="#{relatorioAnimalMB.sair}" />
					</h:panelGrid>
				</div>
			</h:form>
		</p:panel>
	</ui:define>

</ui:composition>